﻿@model string
<script language="javascript" type="text/javascript">
    //var _SendToFriendID = 0;
    //function ConfirmSendToFriend(productID, btn) {
    //    if (_SendToFriendID != productID)
    //        $('#divServerMessage').html('');
    //    _SendToFriendID = productID;
    //    $('#divSendToFriendDialog').modal({ show: true });
    //}
    var _ID = 0;
    function ShowSendToFriend(id, btn) {
        if (_ID != id)
            $('#divServerMessage').html('');
        _ID = id;
        $('#@Model').modal({ show: true });
    }
    function SendToFriend() {
        if ($('#frmSendToFriend').valid()) {
            ShowLoadingAnimation(false);
            Ajax('@Url.PublicUrl("SendProductToFriend", "Ajax")', 'ProductID=' + _ID + '&UserEmail=' + encodeURI($('#YourEmail').val()) + '&FriendEmail=' + encodeURI($('#FriendEmail').val()), function (result) {
                HideLoadingAnimation();
                var status = parseInt(result);
                var html = '';
                if (status == 1) {
                    html = SuccessMessageBox('Congratulations! The property information sent successfully to your friend.');
                    $('#FriendEmail').val('');
                }
                else
                    html = WarningMessageBox('Sorry! something went wrong, we could not send the property info to your friend. Please try after some time.');
                $('#divServerMessage').html(html);
            });
        }
    }
</script>